package com.gexiaobao.pigeon.ui.adapter

import android.graphics.Color
import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.DataBindBaseViewHolder
import com.gexiaobao.pigeon.app.model.bean.GroupListBean
import com.gexiaobao.pigeon.databinding.ItemAboutPassSignProjectBinding

/**
 * @Author      : hxw
 * @Date        : 2024/7/19 14:25
 * @Describe    :
 */
class AdapterAboutPassSignProject : BaseQuickAdapter<GroupListBean, DataBindBaseViewHolder>(R.layout.item_about_pass_sign_project) {
    override fun convert(holder: DataBindBaseViewHolder, item: GroupListBean) {
        val binding = DataBindBaseViewHolder.getBinding(holder) as ItemAboutPassSignProjectBinding
        binding.data = item
        binding.executePendingBindings()//防止列表抖动

        if (holder.layoutPosition % 2 == 0) {//奇数
            holder.setBackgroundColor(R.id.llItem, ContextCompat.getColor(context, R.color.color_6090ed))
        } else {
            holder.setBackgroundColor(R.id.llItem, ContextCompat.getColor(context, R.color.comm_transparent))
        }

        if (holder.layoutPosition == data.size - 1) {
            holder.setBackgroundResource(R.id.llItem, R.drawable.round_bottom_radiu_bg12)
        }
    }
}